!function ($) {
    const $hrefData = location.href.split("?")[1].split("=")[1];

    const $baseurl = "http://localhost/ygsc/php/";
    const $Small_Img = $("#Small_img"); //小图
    const $Big_ImgSrc = $("#Big_Img");  //大图
    const HeaderNeiron = $("h2"); //标题
    const Jiage = $("a[name='jiage']");  //价格
    const Input = $(":input").eq(0);  //数量
    const Btn_Input = $(":input").eq(1);  //提交按钮
    let localNum = [];
    let localSid = [];
    $.ajax({
        url: $baseurl + "data.php",
        data: {
            $goods_id: $hrefData
        },
        dataType: "json",
    }).done(function (data) {
        console.log(data);

        $Small_Img.append(`
        <img src="${data.goods_big_logo}"
        alt srcset  class="Small_Img"/> 
        `);
        $Big_ImgSrc.append(`
        <img src="${data.goods_big_logo}"
        alt srcset  class="Small_Img"/> 
        `)
        HeaderNeiron.html(data.goods_name);
        Jiage.html(data.goods_price);
        Input.val(data.goods_number);

    })
    jQuery.extend({
        locat: function () {
            if (localStorage.getItem("sid") && localStorage.getItem("number")) {
                localNum = localStorage.getItem("sid");
                localSid = localStorage.getItem("number");
            }
            else {
                localSid = [];
                localNum = [];
            }
        }

    })
    //点击添加购物车存储$hrefData和存储数量
    Btn_Input.on("click", function (data) {
        $.locat();
        if (localStorage.getItem("sid")) { //若在localSorage中找到sid,就将数据推入

        }
    })
}(jQuery);